<?php

namespace App\Store\Controllers;

use App\Admin\Models\AdminMenu;
use App\Admin\Models\AdminUser;
use App\Admin\Services\AdminMenuRole;
use App\Common\Services\CommonExcelExport;
use App\Common\Services\Date\DateLunar;
use App\Common\Services\Date\TimerRange;
use App\Common\Services\Upload;
use Illuminate\Http\Request;

use App\Http\Controllers\Controller;
use App\Jobs\WxAccountMsg;
use App\Store\Models\Account\Account;
use App\Store\Models\Account\AccountMenu;
use App\Store\Models\Member\Member;
use App\Store\Models\Order\OrderSales;
use App\Store\Services\AccountMenuRole;
use App\Store\Services\Excel\DownloadTemp;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
use Maatwebsite\Excel\Facades\Excel;
class MyTestController extends Controller
{

    public function testsetrole(){

        $role=AccountMenuRole::setAccountRole(0,9);
        $list=Account::get()->toArray();
        foreach($list as $val){
            if($val['type']!=9){
                $role=AccountMenuRole::setAccountRole($val['id'],$val['type']);
            }


        }
//         AdminMenuRole::setAdminRole(0,1);
//         $list=AdminUser::get()->toArray();
//         foreach($list as $val){
//             if($val['type']!=1){
//                 $role=AdminMenuRole::setAdminRole($val['id'],$val['type']);
//             }
//
//
//         }

         echo '刷新成功！';exit;


    }

    public function testrole(){
        //菜单导入
        $str='[{"path":"/psellStock","keyIndex":"TopNav","meta":{"title":"进销存管理","icon":"logininfo"},"children":[{"path":"/commodityMange","component":"Layout","hidden":false,"meta":{"title":"商品管理","icon":"clipboard"},"name":"commodityMange","children":[{"path":"goodsWarehousing","component":"/manager/psellStock/commodityMange/goodsWarehousing","hidden":false,"meta":{"title":"商品入库列表","buttonList":["撤审","快速审核","批量审核","新品入库","导入","模板下载","导出数据","打印入库单","打印标签","付款"]},"name":"goodsWarehousing"},{"path":"goodsReplenishment","component":"/manager/psellStock/commodityMange/goodsReplenishment","hidden":false,"meta":{"title":"商品补货列表","buttonList":["商品补货单","导入","模板下载","导出数据","打印标签","打印"]},"name":"goodsReplenishment"},{"path":"goodsWarehousingDetail","component":"/manager/psellStock/commodityMange/goodsWarehousingDetail","hidden":false,"meta":{"title":"商品入库列表明细","buttonList":["导出数据"]},"name":"goodsWarehousingDetail"},{"path":"goodsAllocation","component":"/manager/psellStock/commodityMange/goodsAllocation","hidden":false,"meta":{"title":"商品调拨","buttonList":["新增","导出数据","编辑","打印","取消"]},"name":"goodsAllocation"},{"path":"goodsReturn","component":"/manager/psellStock/commodityMange/goodsReturn","hidden":false,"meta":{"title":"商品返厂","buttonList":["新增","批量导入","下载模板","打印明细","全审","处理","删除","查看明细"]},"name":"goodsReturn"},{"path":"inventoryList","component":"/manager/psellStock/commodityMange/inventoryList","hidden":false,"meta":{"title":"商品库存列表","buttonList":["商品添加","批量修改","下载模板","打印标签","批量删除","导出数据","编辑","转旧料","查看"]},"name":"inventoryList"},{"path":"goodsTotalInventory","component":"/manager/psellStock/commodityMange/goodsTotalInventory","hidden":false,"meta":{"title":"商品总库存","buttonList":["导出数据","处理","查看"]},"name":"goodsTotalInventory"},{"path":"commodityFlow","component":"/manager/psellStock/commodityMange/commodityFlow","hidden":false,"meta":{"title":"商品流水","buttonList":["导出数据"]},"name":"commodityFlow"},{"path":"amendantRecord","component":"/manager/psellStock/commodityMange/amendantRecord","hidden":false,"meta":{"title":"商品修改记录列表","buttonList":["导出数据"]},"name":"amendantRecord"}]},{"path":"/orderMange","component":"Layout","hidden":false,"meta":{"title":"订单管理","icon":"shopping"},"name":"orderMange","children":[{"path":"paymentMethod","component":"/manager/psellStock/orderMange/paymentMethod","hidden":false,"meta":{"title":"开单方式","buttonList":[]},"name":"paymentMethod"},{"path":"shopOrder","component":"/manager/psellStock/orderMange/shopOrder","hidden":false,"meta":{"title":"商品订单列表","buttonList":["红冲","导出","计算毛利","编辑","打印","审核","取消"]},"name":"shopOrder"},{"path":"pendingOrder","component":"/manager/psellStock/orderMange/pendingOrder","hidden":false,"meta":{"title":"挂单箱","buttonList":["导出数据","批量支付","支付","取消"]},"name":"pendingOrder"},{"path":"redPunchList","component":"/manager/psellStock/orderMange/redPunchList","hidden":false,"meta":{"title":"红冲列表","buttonList":["导出数据","编辑","审核","取消"]},"name":"redPunchList"},{"path":"orderDetailList","component":"/manager/psellStock/orderMange/orderDetailList","hidden":false,"meta":{"title":"订单明细","buttonList":["导出数据"]},"name":"orderDetailList"},{"path":"exchangeDetailsList","component":"/manager/psellStock/orderMange/exchangeDetailsList","hidden":false,"meta":{"title":"换货明细","buttonList":["导出数据"]},"name":"exchangeDetailsList"}]},{"path":"/usedMaterialsManagement","component":"Layout","hidden":false,"meta":{"title":"旧料管理","icon":"swagger"},"name":"usedMaterialsManagement","children":[{"path":"oldMaterialTotalInventory","component":"/manager/psellStock/usedMaterialsManagement/oldMaterialTotalInventory","hidden":false,"meta":{"title":"旧料总库存","buttonList":["导出数据","处理","查看"]},"name":"oldMaterialTotalInventory"},{"path":"usedStock","component":"/manager/psellStock/usedMaterialsManagement/usedStock","hidden":false,"meta":{"title":"旧料库存","buttonList":["打印明细","导出数据","编辑","上柜"]},"name":"usedStock"},{"path":"usedMaterialsTransfer","component":"/manager/psellStock/usedMaterialsManagement/usedMaterialsTransfer","hidden":false,"meta":{"title":"旧料调拨","buttonList":["新增调拨单","打印明细","导出数据","查看明细","删除"]},"name":"usedMaterialsTransfer"},{"path":"oldMaterialReturn","component":"/manager/psellStock/usedMaterialsManagement/oldMaterialReturn","hidden":false,"meta":{"title":"旧料返厂","buttonList":["新增返厂单","打印明细","导出数据","查看明细","删除"]},"name":"oldMaterialReturn"},{"path":"usedMaterialFlow","component":"/manager/psellStock/usedMaterialsManagement/usedMaterialFlow","hidden":false,"meta":{"title":"旧料流水","buttonList":["导出数据"]},"name":"usedMaterialFlow"},{"path":"oldStock","component":"/manager/psellStock/usedMaterialsManagement/oldStock","hidden":false,"meta":{"title":"存入旧料","buttonList":["新增","导入","下载模板"]},"name":"oldStock"}]},{"path":"/giftManagement","component":"Layout","hidden":false,"meta":{"title":"赠品管理","icon":"international"},"name":"giftManagement","children":[{"path":"giftList","component":"/manager/psellStock/giftManagement/giftList","hidden":false,"meta":{"title":"赠品入库列表","buttonList":["赠品添加","打印","导入","下载模版","导出数据","编辑","审核","取消","删除"]},"name":"giftList"},{"path":"giftAllocationReview","component":"/manager/psellStock/giftManagement/giftAllocationReview","hidden":false,"meta":{"title":"赠品调拨审核","buttonList":["批量审核","导出数据","审核","取消"]},"name":"giftAllocationReview"},{"path":"giftInventoryList","component":"/manager/psellStock/giftManagement/giftInventoryList","hidden":false,"meta":{"title":"赠品库存列表","buttonList":["导出数据","调拨"]},"name":"giftInventoryList"},{"path":"giftFlow","component":"/manager/psellStock/giftManagement/giftFlow","hidden":false,"meta":{"title":"赠品流水列表","buttonList":["导出数据"]},"name":"giftFlow"}]},{"path":"/checkManagement","component":"Layout","hidden":false,"meta":{"title":"盘点管理","icon":"education"},"name":"checkManagement","children":[{"path":"checkList","component":"/manager/psellStock/checkManagement/checkList","hidden":false,"meta":{"title":"盘点列表","buttonList":["盘点计划添加","未盘点导出数据","盘点明细","电脑盘点","删除","已盘导出数据","部分盘导出数据","已盘报表","未盘报表","续盘"]},"name":"checkList"}]}]},{"path":"/marketing","keyIndex":"TopNav","meta":{"title":"会员营销管理","icon":"logininfo"},"children":[{"path":"/memberList","component":"Layout","hidden":false,"meta":{"title":"会员列表","icon":"theme"},"name":"memberList","redirect":"/memberList/memberListIndex","children":[{"path":"memberListIndex","component":"/manager/marketing/memberList/index","hidden":false,"meta":{"title":"会员列表","buttonList":["添加会员","模板下载","导出","导入","一键转出","批量清空积分","批量删除","解绑","编辑会员"]},"name":"memberListIndex"}]},{"path":"/calender","component":"Layout","hidden":false,"meta":{"title":"消费记录","icon":"list"},"name":"calender","children":[{"path":"calenderView","component":"/manager/marketing/calender/index","hidden":false,"meta":{"title":"消费记录","buttonList":["导入","模板下载","导出"]},"name":"calenderView"}]},{"path":"/integral","component":"Layout","hidden":false,"meta":{"title":"积分明细列表","icon":"skill"},"name":"integral","children":[{"path":"integralrView","component":"/manager/marketing/integral/index","hidden":false,"meta":{"title":"积分明细列表","buttonList":["积分添加","导入","模板下载","导出"]},"name":"integralView"}]},{"path":"/prestore","component":"Layout","hidden":false,"meta":{"title":"预存列表","icon":"time-range"},"name":"prestore","children":[{"path":"prestoreView","component":"/manager/marketing/prestore/index","hidden":false,"meta":{"title":"预存列表","buttonList":["打印","导出"]},"name":"prestoreView"}]},{"path":"/pushmessage","component":"Layout","hidden":false,"meta":{"title":"消息推送","icon":"user"},"name":"pushmessage","children":[{"path":"integration","component":"/manager/marketing/pushmessage/integration","hidden":false,"meta":{"title":"积分通知","buttonList":["新增","编辑","发送","删除"]},"name":"integration"},{"path":"shortNotice","component":"/manager/marketing/pushmessage/shortNotice","hidden":false,"meta":{"title":"短息通知","buttonList":["新增","发送","删除"]},"name":"shortNotice"},{"path":"activity","component":"/manager/marketing/pushmessage/activity","hidden":false,"meta":{"title":"活动推送通知","buttonList":["新增","编辑","发送","删除"]},"name":"activity"}]}]},{"path":"/manageForm","keyIndex":"TopNav","meta":{"title":"报表管理","icon":"logininfo"},"children":[{"path":"/commodity","component":"Layout","hidden":false,"meta":{"title":"商品报表","icon":"chart"},"children":[{"path":"storage","component":"/manageForm/commodity/storage","name":"storage","meta":{"title":"库龄分析表","buttonList":["导出","打印"]}},{"path":"salestock","component":"/manageForm/commodity/salestock","name":"salestock","meta":{"title":"进销存报表","buttonList":["导出","打印"]}},{"path":"realtime","component":"/manageForm/commodity/realtime","name":"realtime","meta":{"title":"实时库存表","buttonList":["导出","打印"]}},{"path":"histime","component":"/manageForm/commodity/histime","name":"histime","meta":{"title":"历史库存表","buttonList":["导出","打印"]}},{"path":"giftsummary","component":"/manageForm/commodity/giftsummary","name":"giftsummary","meta":{"title":"赠品汇总","buttonList":["导出","打印"]}},{"path":"inventorywarn","component":"/manageForm/commodity/inventorywarn","name":"inventorywarn","meta":{"title":"库存预警表","buttonList":["导出","新增","编辑","删除"]}}]},{"path":"/operating","component":"Layout","hidden":false,"meta":{"title":"营业报表","icon":"cascader"},"children":[{"path":"businesssummary","component":"/manageForm/operating/businesssummary","name":"businesssummary","meta":{"title":"营业汇总表","buttonList":["导出","打印"]}},{"path":"otherrevenue","component":"/manageForm/operating/otherrevenue","name":"otherrevenue","meta":{"title":"其他收支表","buttonList":["新增","导出","打印"]}},{"path":"grossmargin","component":"/manageForm/operating/grossmargin","name":"grossmargin","meta":{"title":"毛利表","buttonList":["导出","打印"]}},{"path":"oldprofit","component":"/manageForm/operating/oldprofit","name":"oldprofit","meta":{"title":"旧料统计表","buttonList":["导出","打印"]}},{"path":"salesparticular","component":"/manageForm/operating/salesparticular","name":"salesparticular","meta":{"title":"销售明细报表","buttonList":["导出","打印"]}},{"path":"salesperformance","component":"/manageForm/operating/salesperformance","name":"salesperformance","meta":{"title":"销售业绩表","buttonList":["导出","查看明细"]}},{"path":"salescommissions","component":"/manageForm/operating/salescommissions","name":"salescommissions","meta":{"title":"销售提成表","buttonList":[]}}]},{"path":"/finance","component":"Layout","hidden":false,"meta":{"title":"财务报表","icon":"clipboard"},"children":[{"path":"rate","component":"/manageForm/finance/rate","name":"rate","meta":{"title":"费率表","buttonList":["导出","打印","新增","编辑","删除"]}},{"path":"subject","component":"/manageForm/finance/subject","name":"subject","meta":{"title":"科目管理","buttonList":["导出","打印","新增","编辑","删除"]}},{"path":"cash","component":"/manageForm/finance/cash","name":"cash","meta":{"title":"现金日记账","buttonList":["导出","新增","编辑","删除"]}},{"path":"bank","component":"/manageForm/finance/bank","name":"bank","meta":{"title":"银行日记账","buttonList":["导出","新增","编辑","删除"]}},{"path":"valuecard","component":"/manageForm/finance/valuecard","name":"valuecard","meta":{"title":"储值卡","buttonList":["导出","新增","编辑","删除"]}},{"path":"property","component":"/manageForm/finance/property","name":"property","meta":{"title":"资产负债表","buttonList":["导出","打印"]}},{"path":"profit","component":"/manageForm/finance/profit","name":"profit","meta":{"title":"利润表","buttonList":["导出","打印","完善报表"]}}]}]},{"path":"/basicSetting","keyIndex":"TopNav","meta":{"title":"基础设置","icon":"logininfo"},"children":[{"path":"/basicBank","component":"Layout","hidden":false,"meta":{"title":"基本资料","icon":"documentation"},"children":[{"path":"gold","component":"/manager/basic/bank/gold","name":"gold","meta":{"title":"金价管理列表","buttonList":["新增","编辑","删除","批量新增","金价维护","导出","复制数据"]}},{"path":"group","component":"/manager/basic/bank/group","name":"group","meta":{"title":"柜组列表","buttonList":["新增","编辑","删除","导入","模板下载"]}},{"path":"merch","component":"/manager/basic/bank/merch","name":"merch","meta":{"title":"商品类别列表","buttonList":["新增","编辑","删除","导入","模板下载"]}},{"path":"shopstyle","component":"/manager/basic/bank/shopstyle","name":"shopstyle","meta":{"title":"商品款式列表","buttonList":["新增","编辑","删除","导入","模板下载"]}},{"path":"metal","component":"/manager/basic/bank/metal","name":"metal","meta":{"title":"金属材质列表","buttonList":["新增","编辑","删除"]}},{"path":"technology","component":"/manager/basic/bank/technology","name":"technology","meta":{"title":"商品工艺列表","buttonList":["新增","编辑","删除","导入","模板下载"]}},{"path":"grade","component":"/manager/basic/bank/grade","name":"grade","meta":{"title":"会员等级列表","buttonList":["新增","编辑"]}},{"path":"pricetype","component":"/manager/basic/bank/pricetype","name":"pricetype","meta":{"title":"价格类型列表","buttonList":["新增","编辑","删除"]}},{"path":"brandlist","component":"/manager/basic/bank/brandlist","name":"brandlist","meta":{"title":"品牌名单列表","buttonList":["新增","编辑","删除"]}},{"path":"payinouttype","component":"/manager/basic/bank/payinouttype","name":"payinouttype","meta":{"title":"收支类型列表","buttonList":["新增","编辑","删除","导入","模板下载"]}},{"path":"ordernote","component":"/manager/basic/bank/ordernote","name":"ordernote","meta":{"title":"订单备注列表","buttonList":["新增","编辑","删除"]}},{"path":"stone","component":"/manager/basic/bank/stone","name":"stone","meta":{"title":"石料材质列表","buttonList":["新增","编辑","删除"]}},{"path":"pricing","component":"/manager/basic/bank/pricing","name":"pricing","meta":{"title":"标价计算公式列表","buttonList":[]}},{"path":"returntype","component":"/manager/basic/bank/returntype","name":"returntype","meta":{"title":"返厂类型列表","buttonList":["新增","编辑","删除"]}},{"path":"supplier","component":"/manager/basic/bank/supplier","name":"supplier","meta":{"title":"供应商","buttonList":["新增","编辑","删除"]}}]},{"path":"/templatefile","component":"Layout","hidden":false,"meta":{"title":"模板","icon":"swagger"},"children":[{"path":"pledgebond","component":"/manager/basic/templatefile/pledgebond","name":"pledgebond","meta":{"title":"质保单模板","buttonList":["新增","设计","复制","编辑","删除","导入","模板下载","导出"]}},{"path":"labeltag","component":"/manager/basic/templatefile/labeltag","name":"labeltag","meta":{"title":"标签模板","buttonList":["新增","设计","复制","编辑","删除","导入","模板下载","导出"]}}]},{"path":"/basicShoptype","component":"Layout","hidden":false,"meta":{"title":"商品类型","icon":"tab"},"children":[{"path":"shoptype","component":"/manager/basic/shoptype/index","name":"shoptype","meta":{"title":"商品类型","buttonList":["新增","编辑","删除"]}}]},{"path":"/basicPaytype","component":"Layout","hidden":false,"meta":{"title":"支付方式","icon":"server"},"children":[{"path":"paytype","component":"/manager/basic/paytype/index","name":"paytype","meta":{"title":"支付方式","buttonList":["新增","编辑","删除"]}}]}]},{"path":"/accountManage","keyIndex":"TopNav","meta":{"title":"账号管理","icon":"logininfo"},"children":[{"path":"/publicMypanel","component":"Layout","hidden":false,"meta":{"title":"我的面板","icon":"people"},"children":[{"path":"publicMypanelM","component":"/public/mypanel/message","name":"publicMypanelM","meta":{"title":"个人信息","icon":"logininfor"}},{"path":"publicMypanelP","component":"/public/mypanel/password","name":"publicMypanelP","meta":{"title":"修改密码","icon":"logininfor"}}]},{"path":"/limits","component":"Layout","hidden":false,"meta":{"title":"权限管理","icon":"system"},"children":[{"path":"personlimits","component":"/manager/accountManage/limits/personlimits","name":"personlimits","meta":{"title":"人员管理","icon":"logininfor","buttonList":["新增","分配权限","编辑","删除","重置密码"]}},{"path":"section","component":"/manager/accountManage/limits/section","name":"section","meta":{"title":"部门管理","icon":"logininfor","buttonList":["新增","编辑","管理员"]}}]}]},{"path":"/setSystem","keyIndex":"TopNav","meta":{"title":"系统设置","icon":"logininfo"},"children":[{"path":"/rechargeParameterSetting","component":"Layout","hidden":false,"meta":{"title":"充值参数设置","icon":"drag"},"name":"rechargeParameterSetting","children":[{"path":"preStoredRechargeSettings","component":"/manager/systemSettings/rechargeParameterSetting/preStoredRechargeSettings","name":"preStoredRechargeSettings","meta":{"title":"预存充值设置","buttonList":["新增","编辑","删除"]}}]},{"path":"/commissionSetting","component":"Layout","hidden":false,"meta":{"title":"提成规则设置","icon":"example"},"name":"commissionSetting","children":[{"path":"discountCommission","component":"/manager/systemSettings/commissionSetting/discountCommission","name":"discountCommission","meta":{"title":"折扣提成","buttonList":["新增","编辑","删除"]}},{"path":"preferentialCommission","component":"/manager/systemSettings/commissionSetting/preferentialCommission","name":"preferentialCommission","meta":{"title":"优惠提成","buttonList":["新增","编辑","删除"]}},{"path":"goldWorkFeeCommission","component":"/manager/systemSettings/commissionSetting/goldWorkFeeCommission","name":"goldWorkFeeCommission","meta":{"title":"金价工费提成","buttonList":["新增","编辑","删除"]}},{"path":"exchangeCommission","component":"/manager/systemSettings/commissionSetting/exchangeCommission","name":"exchangeCommission","meta":{"title":"换货提成","buttonList":["新增","编辑","删除"]}},{"path":"depositRecycleCommission","component":"/manager/systemSettings/commissionSetting/depositRecycleCommission","name":"depositRecycleCommission","meta":{"title":"纯回收提成","buttonList":["新增","编辑","删除"]}}]},{"path":"/shiftSetting","component":"Layout","hidden":false,"meta":{"title":"班次设置","icon":"guide"},"children":[{"path":"shiftSettingIndex","component":"/manager/systemSettings/shiftSetting/index","name":"shiftSettingIndex","meta":{"title":"班次设置","buttonList":["新增","编辑","删除"]}}]},{"path":"/integrationRuleSetting","component":"Layout","hidden":false,"meta":{"title":"积分规则设置","icon":"money"},"name":"integrationRuleSetting","children":[{"path":"integralSetting","component":"/manager/systemSettings/integrationRuleSetting/integralSetting","name":"integralSetting","meta":{"title":"积分设置","buttonList":["新增","编辑","删除"]}},{"path":"checkInScore","component":"/manager/systemSettings/integrationRuleSetting/checkInScore","name":"checkInScore","meta":{"title":"签到积分","buttonList":["保存"]}},{"path":"signinusemoney","component":"/manager/systemSettings/integrationRuleSetting/signinusemoney","name":"signinusemoney","meta":{"title":"使用金额","buttonList":["新增","编辑","删除"]}}]},{"path":"/user-store","component":"Layout","hidden":false,"meta":{"title":"门店列表","icon":"documentation"},"children":[{"path":"userStoreIndex","component":"/manager/systemSettings/store/index","name":"userStoreIndex","meta":{"title":"门店列表","buttonList":["关闭增值回收","开启增值回收","导出"]}}]},{"path":"/sysRenew","component":"Layout","hidden":false,"meta":{"title":"续费管理","icon":"guide"},"children":[{"path":"sysRenewIndex","component":"/manager/systemSettings/renew/index","name":"sysRenewIndex","meta":{"title":"续费管理","buttonList":["续费设置"]}}]},{"path":"/logManagement","component":"Layout","hidden":false,"meta":{"title":"日志管理","icon":"list"},"name":"logManagement","children":[{"path":"operationLog","component":"/manager/systemSettings/logManagement/operationLog","name":"operationLog","meta":{"title":"操作日志","buttonList":["删除"]}},{"path":"entryLog","component":"/manager/systemSettings/logManagement/entryLog","name":"entryLog","meta":{"title":"登录日志","buttonList":["删除"]}}]}]},{"path":"/videoAam","keyIndex":"TopNav","meta":{"title":"视频管理","icon":"logininfo"},"children":[{"path":"/opertionVideo","component":"Layout","hidden":false,"meta":{"title":"视频管理","icon":"eye-open"},"children":[{"path":"video","component":"/opertion/video/index","name":"video","meta":{"title":"视频教程","buttonList":["上传视频"]}}]}]},{"path":"/mmpAam","keyIndex":"TopNav","meta":{"title":"小程序管理","icon":"logininfo"},"children":[{"path":"/electronic","component":"Layout","hidden":false,"meta":{"title":"电子券管理","icon":"star"},"children":[{"path":"electronicIndex","component":"/miniProgram/electronic/index","name":"electronicIndex","meta":{"title":"电子券管理","buttonList":["电子券添加","发放明细","删除"]}}]},{"path":"/present","component":"Layout","hidden":false,"name":"present","meta":{"title":"礼品管理","icon":"shopping"},"children":[{"path":"presentStockList","component":"/miniProgram/present/presentStockList","name":"presentStockList","meta":{"title":"礼品库存列表","buttonList":["礼品添加","导入","下载模板","打印标签","删除","调拨","编辑","查看流水","入库","审核","取消"]}},{"path":"presentAllotList","component":"/miniProgram/present/presentAllotList","name":"presentAllotList","meta":{"title":"礼品调拨列表","buttonList":["审核","取消"]}},{"path":"presentConversionList","component":"/miniProgram/present/presentConversionList","name":"presentConversionList","meta":{"title":"礼品兑换列表","buttonList":["导出数据","兑换"]}},{"path":"presentFlowList","component":"/miniProgram/present/presentFlowList","name":"presentFlowList","meta":{"title":"礼品流水列表","buttonList":["导出数据"]}},{"path":"presentCategoryList","component":"/miniProgram/present/presentCategoryList","name":"presentCategoryList","meta":{"title":"礼品库类别列表","buttonList":["添加礼品类别","编辑","删除"]}}]},{"path":"/wxSwipper","component":"Layout","hidden":false,"meta":{"title":"轮播图管理","icon":"date"},"children":[{"path":"wxSwipperIndex","component":"/miniProgram/swipper/index","name":"wxSwipperIndex","meta":{"title":"轮播图管理","buttonList":["新增","删除"]}}]},{"path":"/weixin","component":"Layout","hidden":false,"meta":{"title":"微信平台配置","icon":"wechat"},"children":[{"path":"weixinIndex","component":"/miniProgram/weixin/index","name":"weixinIndex","meta":{"title":"微信平台配置","buttonList":["保存"]}}]},{"path":"/official","component":"Layout","hidden":false,"meta":{"title":"公众号配置","icon":"validCode"},"children":[{"path":"officialIndex","component":"/miniProgram/official/index","name":"officialIndex","meta":{"title":"公众号配置","buttonList":["保存","微信推送保存"]}}]},{"path":"/SMSConfiguration","component":"Layout","hidden":false,"meta":{"title":"短信配置","icon":"email"},"children":[{"path":"SMSConfigurationIndex","component":"/miniProgram/SMSConfiguration/index","name":"SMSConfigurationIndex","meta":{"title":"短信配置","buttonList":["短息配置保存","短息模板配置保存"]}}]},{"path":"/warrantycard","component":"Layout","hidden":false,"meta":{"title":"质保单设置","icon":"education"},"children":[{"path":"hint","component":"/miniProgram/warrantycard/hint","name":"hint","meta":{"title":"温馨提示内容编辑","buttonList":["保存"]}},{"path":"sale","component":"/miniProgram/warrantycard/sale","name":"sale","meta":{"title":"售后服务承诺编辑","buttonList":["保存"]}},{"path":"electronic","component":"/miniProgram/warrantycard/electronic","name":"electronic","meta":{"title":"电子章","buttonList":["新增","开关"]}}]}]}]';
        $str_arr=json_decode($str,true);
        // print_r($str_arr);exit;
        foreach ($str_arr as $val) {
            $data = [
                'path' => $val['path'],
                'name' => isset($val['name'])?$val['name']:'',
                'component' => isset($val['component'])?$val['component']:'',
                'hidden' => 0,
                'title' => $val['meta']['title'],
                'icon' => isset($val['meta']['icon'])?$val['meta']['icon']:'',
                'props'=>isset($val['props'])?json_encode($val['props']):'',
                'keyIndex'=>isset($val['keyIndex'])?$val['keyIndex']:'',
            ];
            $pid = AccountMenu::create($data)->id;
            if (isset($val['children'])) {
                foreach ($val['children'] as $children) {
                    $subdata = [
                        'path' => $children['path'],
                        'pid' => $pid,
                        'name' => isset($children['name'])?$children['name']:'',
                        'component' => $children['component'],
                        'hidden' => 0,
                        'title' => $children['meta']['title'],
                        'icon' => isset($children['meta']['icon'])?$children['meta']['icon']:'',
                        'props'=>isset($children['props'])?json_encode($children['props']):'',
                    ];
                    $ppid = AccountMenu::create($subdata)->id;

                    if (isset($children['meta']['buttonList'])) {
                        foreach ($children['meta']['buttonList'] as $button) {
                            $buttondata = [
                                'pid' => $ppid,
                                'name' => $button,
                                'is_botton' => 1
                            ];
                            AccountMenu::create($buttondata);
                        }
                    }

                    if (isset($children['children'])) {
                        foreach ($children['children'] as $childrenchildren) {
                            $subsubdata = [
                                'path' => $childrenchildren['path'],
                                'pid' => $ppid,
                                'name' => $childrenchildren['name'],
                                'component' => $childrenchildren['component'],
                                'hidden' => 0,
                                'title' => $childrenchildren['meta']['title'],
                                'icon' => isset($childrenchildren['meta']['icon'])?$childrenchildren['meta']['icon']:'',
                                'props'=>isset($childrenchildren['props'])?json_encode($childrenchildren['props']):'',
                            ];
                            $pppid = AccountMenu::create($subsubdata)->id;

                            if (isset($childrenchildren['meta']['buttonList'])) {
                                foreach ($childrenchildren['meta']['buttonList'] as $button) {
                                    $buttondata = [
                                        'pid' => $pppid,
                                        'name' => $button,
                                        'is_botton' => 1
                                    ];
                                    AccountMenu::create($buttondata);
                                }
                            }
                        }
                    }
                }
            }

            if (isset($val['meta']['buttonList'])) {
                foreach ($val['meta']['buttonList'] as $button) {
                    $buttondata = [
                        'pid' => $pid,
                        'name' => $button,
                        'is_botton' => 1
                    ];
                    AccountMenu::create($buttondata);
                }
            }
        }
    }
}
